In virtual machines and in other systems, the state of the machine is generally not fully known at all points in time. For example, as code is being executed, there may be partial results computed for pointers and stored in registers. A safe point is a point in the code where enough state is known that certain operations can be safely performed. For example, it may be desirable to bring a thread to a safe point to scan its stack for pointers that need to be followed or modified during garbage collection. It may be desirable to bring all threads in a virtual machine to a safe point to perform garbage collection, debugging, or other safe operations. Typically, a context switch between threads may occur at any point in the code, with the operating system preempting a running thread at what appears to be a random instruction. In this typical situation, when a request to bring the threads to a safe point is received, each of the threads needs to be context switched back in and brought to a safe point. This process can be computationally expensive and time consuming, and lengthens the time it takes to perform operations that require safe points. Improved methods of context switching, thread preemption, and reaching a safe point are needed.